﻿using System;
using System.Web.Mvc;
using Icms.Core.Service;
using Omu.Awesome.Mvc;

namespace Icms.WebUI.Controllers
{
    [Authorize]
    public class BackupLogController : BaseController
    {
        private readonly IBackupLogService s;

        public BackupLogController(IBackupLogService s)
        {
            this.s = s;
        }

        public virtual ActionResult Search(Guid? court, int page = 1, int ps = 5)
        {
            int count;
            var src = s.GetPage(page, ps, court, out count);
            var rows = this.RenderView("rows", src);

            return Json(new { rows, more = count > page * ps });
        }

        public virtual ActionResult Index()
        {
            ViewBag.DisableCreate = true;
            return View("cruds");
        }
    }
}